<!-- 分类面板 -->
<template>
	<view class="container">
		<view class="body">
			<view class="select">
				<view class="option" v-for="item in select" :key="item.value" :class="{'checked': item.isChecked}">
					{{item.name}}
				</view>
			</view>
			<view class="result">
				<text class="tag" v-for="item in result" :key="item.value" :class="{'checked': item.isChecked}">{{item.name}}</text>
			</view>
		</view>

		<!-- 按钮组 -->
		<view class="footer">
			<button class="btn plain border-1px btn-transition-scale95">重 置</button>
			<button class="btn active btn-transition-scale95">确 定</button>
		</view>
	</view>
</template>

<script setup>
	import { ref } from "vue";

	const select = ref([
		{ name: '不限', value: '0', isChecked: true },
		{ name: '按药品', value: '1', isChecked: false },
		{ name: '按作物', value: '2', isChecked: false },
	]);

	const result = ref([
		{ name: '不限', value: '0', isChecked: false },
		{ name: '杀虫剂', value: '1', isChecked: true },
		{ name: '除草剂', value: '2', isChecked: false },
		{ name: '红火蚁饵剂', value: '3', isChecked: false },
		{ name: '化肥', value: '4', isChecked: false },
	])
</script>

<style lang="scss" scoped>
	.container {
		position: absolute;
		top: 192rpx;
		left: 0;
		width: 100%;
		background-color: white;
		border-radius: 0 0 20rpx 20rpx;

		.body {
			display: flex;
			height: 500rpx;

			.select {
				flex-shrink: 0;
				width: 33.3%;
				height: 100%;
				overflow-y: auto;
				background-color: #f5f5f5;

				.option {
					height: 70rpx;
					font-size: 26rpx;
					color: #222;
					text-align: center;
					line-height: 70rpx;

					&.checked {
						position: relative;
						font-weight: bold;
						background-color: white;

						&::before {
							position: absolute;
							top: 0;
							left: 0;
							width: 6rpx;
							height: 100%;
							display: block;
							content: '';
							background-color: #FE3333;
						}
					}
				}
			}

			.result {
				flex-grow: 1;
				height: 100%;
				padding-bottom: 20rpx;
				box-sizing: border-box;
				overflow-y: auto;
				
				.tag {
					display: inline-block;
					min-width: 134rpx;
					height: 54rpx;
					font-size: 24rpx;
					color: #222222;
					text-align: center;
					line-height: 54rpx;
					background: #F2F2F4;
					border-radius: 30rpx;
					padding: 0 30rpx;
					box-sizing: border-box;
					margin: 20rpx 0 0 20rpx;
					
					&.checked {
						color: #FE3333;
						background: #FFDDDD;
					}
				}
			}
		}

		.footer {
			flex-shrink: 0;
			display: flex;
			align-items: center;
			justify-content: center;
			height: 90rpx;

			.btn {
				width: 220rpx;
				height: 70rpx;
				border-radius: 50rpx;
				font-size: 28rpx;
				text-align: center;
				line-height: 70rpx;

				&+.btn {
					margin-left: 40rpx;
				}

				&.plain {
					color: #222;
					background-color: transparent;

					&::after {
						border-radius: 100rpx;
					}
				}

				&.active {
					color: white;
					background-color: #FE3333;
				}
			}
		}
	}
</style>